import React from "react";

class Time extends React.Component {
    state = {
        time: new Date().toLocaleTimeString(),
    };

    componentDidMount() {
        setInterval(() => {
            this.setState({
                time: new Date().toLocaleTimeString(),
            });
        }, 1000);
    }

    render() {
        return (
            <div>
                <p>{this.state.time}</p>
            </div>
        );
    }
}

export default Time;
